<%@ page language="java" import="java.util.*" pageEncoding="Utf-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加会员</title>
<link rel="stylesheet" href="${pageContext.request.contextPath}/common/style/base.css" type="text/css" media="screen" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/common/style/page.css" type="text/css" media="screen" />
<link rel="stylesheet" href="${pageContext.request.contextPath}/common/src/css/jscal2.css" type="text/css" media="screen" />
<script src="${pageContext.request.contextPath}/common/js/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/common/js/common.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/common/js/pagetab.js" type="text/javascript"></script>

<script src="${pageContext.request.contextPath}/common/src/js/jscal2.js" type="text/javascript"></script>
<script src="${pageContext.request.contextPath}/common/src/js/lang/cn.js" type="text/javascript"></script>

<script type="text/javascript" src="${pageContext.request.contextPath}/common/js/formvalidator.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/common/js/formvalidatorregex.js"></script>
<script type="text/javascript">
	$(function(){
		$.formValidator.initConfig({formid:"form",autotip:true});
		$("#name").formValidator({onshow:"请输入用户名",onfocus:"用户名应该为2-20位之间"}).inputValidator({min:2,max:20,onerror:"用户名应该为2-20位之间"}).regexValidator({regexp:"notempty",datatype:"enum",onerror:"请输入用户名"})
		.ajaxValidator({
		datatype : "json",
		async : false,
		type:"post",
		url : "checkUser.action",
		success : function(data){
			if(data.success) return true;
	        return false;
		},
		onerror : "该用户名已存在，请更换",
		onWait : "正在验证用户名，请稍候..."
		});
		$("#password").formValidator({onshow:"请输入密码",onfocus:"密码应该为6-20位之间"}).inputValidator({min:6,max:20,onerror:"密码应该为6-20位之间"});
		$("#repassword").formValidator({onshow:"请输入确认密码",onfocus:"请输入两次密码相同。",oncorrect:"密码输入一致"}).compareValidator({desid:"password",operateor:"=",onerror:"请输入两次密码不同。"});
		$("#email").formValidator({onshow:"请输入E-mail",onfocus:"E-mail格式错误",oncorrect:"E-mail格式正确"}).regexValidator({regexp:"email",datatype:"enum",onerror:"E-mail格式错误"});
	})

function submit1(){
	if(confirm("请确定用户名，注册后无法更改！")){
	$("#url").val('panel/member/getMemberListByPage.action');
	$("#form").submit();
	}
}

function submit2(){
	if(confirm("请确定用户名，注册后无法更改！")){
	$("#form").submit();
	}
}

</script>
</head>
<body>

<form id="form" action="save.action" method="post">
<input type="hidden" name="url" id="url"/>			
<div id="main_frame">	
	<div id="pagemenu">
	<a href="getMemberListByPage.action" title="会员列表">会员列表</a>|<a href="javascript:void(0);" class="selected">添加会员</a>
	</div>
	
	<div class="listtitle">
		<ul>
			<li class="selected"><a href="javascript:void(0);" title="基本信息">基本信息</a></li>
			<li><a href="javascript:void(0);" title="详细信息">详细信息</a></li>
		</ul>
	</div>
	<div class="listbox">
		<div>
			<table class="addtab"  align="center">
				<tr>
					<th>用户名</th>
					<td>
					<input type="text" class="tx6" name="member.name" title="用户名" id="name" /></td>
				</tr>
				<tr>
					<th>E-mail</th>
					<td><input type="text" class="tx6" name="member.email"  title="请输入E-mail" id="email"/></td>
				</tr>
				<tr>
					<th>密码</th>
					<td><input type="password" class="tx6" name="member.password"  title="请输入密码" id="password"/></td>
				</tr>	
				<tr>
					<th>确认密码</th>
					<td><input type="password" class="tx6" value="" title="请输入确认密码" id="repassword"/></td>
				</tr>
				<tr>
					<th>状态</th>
					<td>
					<label><input type="radio" name="member.state" checked="checked" value="true" id="state"/>正常</label>
					<label><input type="radio" name="member.state" value="false" id="state"/>禁用</label>
					</td>
				</tr>
			</table>
		</div>
		<div class="hidden">
			<table class="addtab"  align="center">
				<tr>
					<th>真实姓名</th>
					<td><input type="text" name="memberInfo.realName" id="realName" class="tx6" title="真实姓名"/></td>
				</tr>
				<tr>
					<th>性别</th>
					<td>
					<label><input type="radio" name="memberInfo.sex" checked="checked" value="true" id="sex"/>女</label>
					<label><input type="radio" name="memberInfo.sex" value="false" id="sex"/>男</label>
					</td>
				</tr>

				<tr>
					<th>手机号码</th>
					<td><input type="text" name="memberInfo.mobile" id="mobile" class="tx6" title="手机号码"/></td>
				</tr>

				<tr>
					<th>生日</th>
					<td>
						<input type="text" name="memberInfo.birthday" class="dateinput" id="birthday" title="生日" value=""/>
						<script type="text/javascript">
							Calendar.setup({
							weekNumbers: true,
							inputField : "birthday",
							trigger    : "birthday",
							dateFormat: "%Y-%m-%d",
							minuteStep: 1,
							onSelect   : function() {this.hide();}
							});
						</script>
					</td>
				</tr>

				<tr>
					<th>身份证号码</th>
					<td><input type="text" name="memberInfo.ldnum" class="tx6" id="ldnum" title="身份证号码"/></td>
				</tr>

				<tr>
					<th>联系地址</th>
					<td>
						<input type="text" name="memberInfo.address" class="tx6" id="address" title="联系地址"/>
					</td>
				</tr>

			</table>
			
		</div>
		
	</div>
</div>
</form>
<div id="bottombar">
	<div class="fr btns"><input onclick="submit1();" type="button" value="保存后返回" class="savebtn1"/><input type="button" onclick="submit2();" value="保存并继续" class="savebtn1" /><input type="button" value="取消" class="cancelbtn" onclick="history.go(-1)"/></div>
</div>
</body>
</html>